home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / tcplusx.zip / EVENTMGR.H < prev    next >
C/C++ Source or Header  |  1991-02-24  |  5KB  |  211 lines

  1. #ifndef _EVENTMGR_H
  2. #define _EVENTMGR_H
  3.  
  4. //
  5. // eventmgr.h     - header file for class EventManager
  6. // Author        - Robin W. McKean
  7. // Last Update    - February 23,1991
  8. // Copyright (C) 1991 All rights reserved
  9. //
  10. // This file remains the property of the author, Robin W. McKean.  You are
  11. // free to use and change it as you see fit.  This module, nor its object
  12. // code, may not however be included  in any packaged software without the
  13. // written consent of the author.
  14. //
  15.  
  16. // Contents ----------------------------------------------------------------
  17. //
  18. //        eventManagerClass
  19. //        EventManager
  20. //
  21. // Description
  22. //
  23. //        The purpose if this class is to command and control all of the
  24. //        devices that a programmer wants to use as input.  The devices will
  25. //        feed events to the event manager, and the programmer can access
  26. //        those events by calling EventManager::getEvent( Event& ).  Also, the
  27. //        programmer can put their own events into the queue by calling
  28. //        EventManager::putEvent( Event&, int ).
  29. //
  30. // End ---------------------------------------------------------------------
  31.  
  32. // Interface dependencies --------------------------------------------------
  33.  
  34. #ifndef _OBJECT_H
  35. #include <object.h>
  36. #endif
  37.  
  38. #ifndef _GEN_H
  39. #include <gen.h>
  40. #endif
  41.  
  42. #ifndef _USETYPES_H
  43. #include <usetypes.h>
  44. #endif
  45.  
  46. #ifndef _IOSTREAM_H
  47. #include <iostream.h>
  48. #endif
  49.  
  50. // End Interface dependencies ----------------------------------------------
  51.  
  52. // Implementation dependencies ---------------------------------------------
  53.  
  54. #ifndef _DBLLIST_H
  55. #include <dbllist.h>
  56. #endif
  57.  
  58. #ifndef _LIST_H
  59. #include <list.h>
  60. #endif
  61.  
  62. #ifndef _DEQUE_H
  63. #include <deque.h>
  64. #endif
  65.  
  66. #ifndef _EVENT_H
  67. #include <event.h>
  68. #endif
  69.  
  70. // End Implementation dependencies -----------------------------------------
  71.  
  72. // Class //
  73.  
  74. class EventManager : public Object
  75. {
  76. public:
  77.     EventManager( int maxEvents );
  78.     ~EventManager( void );
  79.  
  80.     classType        isA( ) const;
  81.     char            *nameOf( ) const;
  82.     hashValueType    hashValue( ) const;
  83.     int             isEqual( const Object& ) const;
  84.     void            printOn( ostream& ) const;
  85.  
  86.     void            putEvent( Event& theEvent, int atBeginning = FALSE );
  87.     void            getEvent( Event& theEvent );
  88.  
  89.     void            positionDevice( classType device, int row, int column );
  90.     void            showDevice( classType device );
  91.     void            hideDevice( classType device );
  92.     void            addDevice( Object& theDevice );
  93.     void            subtractDevice( Object& theDevice );
  94.  
  95.     void            operator += ( Object& theDevice ) 
  96.                         { addDevice( theDevice ); }
  97.     void            operator -= ( Object& theDevice )
  98.                         { subtractDevice( theDevice ); }
  99.  
  100. private:
  101.     Deque queueList;
  102.     DoubleList freeList;
  103.     List deviceList;
  104.     Event *events;
  105.     int eventMax;
  106. };
  107.  
  108. // Description -------------------------------------------------------------
  109. //
  110. //    Member Functions:
  111. //
  112. //    Constructor
  113. //
  114. //        The constructor sets up the queues and lists, and sets the maximum
  115. //        number of events the queue may hold.
  116. //
  117. //    Destructor
  118. //
  119. //        The destructor destroys the list and frees the events.
  120. //
  121. //    isA
  122. //
  123. //        Returns the class type eventManagerClass
  124. //
  125. // nameOf
  126. //
  127. //        Returns "EventManager"
  128. //
  129. //    hashValue
  130. //
  131. //        This object has no hash value, so it returns 0.
  132. //
  133. //    isEqual
  134. //
  135. //        NO EventManager classes may be equal, so I don't think you could
  136. //        possibly need more than one of these
  137. //
  138. //    printOn
  139. //
  140. //        This will dump the device list, and the queue list to cout.
  141. //
  142. //    putEvent
  143. //
  144. //        This puts an event into the queue, depending on where the user
  145. //        requested.  Set atBeginning to one if it should go in front.
  146. //
  147. //    getEvent
  148. //
  149. //        This will return an event if one is available in the queue, or it
  150. //        will poll the devices until one comes available
  151. //
  152. //    positionDevice
  153. //
  154. //        This will position a device.  You pass it the class type of the
  155. //        device as listed below, and the row/column location.
  156. //
  157. //                Cursor:        cursorClass
  158. //                Mouse:        mouseClass
  159. //        
  160. //
  161. //    showDevice
  162. //
  163. //        This will turn on a device that was previously turned off.
  164. //
  165. //    hideDevice
  166. //
  167. //        This will hide the device
  168. //
  169. //    addDevice
  170. //
  171. //        This will add a device to the event managers queue.  It will be
  172. //        polled for information to place into the queue.
  173. //
  174. //    subtractDevice
  175. //
  176. //        This will subtract a device from the device list.
  177. //
  178. //    operator +=
  179. //
  180. //        The same as addDevice
  181. //
  182. //    operator -=
  183. //
  184. //        The same as subtractDevice
  185. //
  186. //    Member classes or variables
  187. //
  188. //    queueList
  189. //
  190. //        Double ended queue that will hold our events
  191. //
  192. //    deviceList
  193. //
  194. //        Single list that holds all of our devices
  195. //
  196. //    freeList
  197. //
  198. //        Contains the events that are free to be added to the queue
  199. //
  200. //    events
  201. //
  202. //        The pointer to the events created by the constructor
  203. //
  204. //    eventMax
  205. //
  206. //        The number of events in the free list
  207. //
  208. // End Summary -------------------------------------------------------------
  209.  
  210. #endif        // _EVENTMGR_H //
  211.